<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"
              encoding="utf-8"
              media-type="text/html"
              doctype-public="-//W3C//DTD HTML 4.01//EN"
              doctype-system="http://www.w3.org/TR/xtml4/strict.dtd" />

  <xsl:template match="/">
    <xsl:apply-templates select="ValCurs" />
  </xsl:template>

  <xsl:template match="ValCurs">
    <table class='informer ui-corner-all' id='crb-rate'>
      <tr>
        <th class='ui-corner-top' colspan='2' title='По курсу ЦБ РФ'>
          <xsl:variable name="date" select="substring-after(@Date, '.')" />
          <a href='http://www.cbr.ru/currency_base/daily.aspx?C_month={substring-before($date, ".")}&#38;C_year={substring-after($date, ".")}&#38;date_req={@Date}' class='currency' target='_blank'>
            RUB / <span><xsl:value-of select="@Date" /></span>
          </a>
        </th>
      </tr>
      <xsl:apply-templates select="Valute[@ID='R01239']" />
      <xsl:apply-templates select="Valute[@ID='R01235']" />
    </table>
  </xsl:template>

  <xsl:template match="Valute">
    <tr id='{@ID}' title='{Name}'>
      <td>
        <span class='currency'>
          <xsl:value-of select="CharCode" />
        </span>
      </td>
      <td class='cur-val'>
        <xsl:value-of select="Value" />
      </td>
    </tr>
  </xsl:template>

</xsl:stylesheet>
